import { ElMessageBox } from 'element-plus';

// 确认弹框
export const baseConfirm = (options: any = {}) => {
  return new Promise((resolve, reject) => {
    ElMessageBox.confirm(
      options.message,
      options.title || '提示',
      {
        type: options.type || 'warning',
        confirmButtonText: options.confirmButtonText || '确定',
        cancelButtonText: options.cancelButtonText || '取消',
        autofocus: false
      }
    )
      .then(resolve)
      .catch(reject);
  });
};
/** 基础信息弹窗（仅做Alert，没有交互） */
export const baseAlert = (options: any = {}) => {
  return new Promise((resolve, reject) => {
    ElMessageBox.alert(
      options.message,
      options.title || '提示',
      {
        type: options.type || 'warning',
        confirmButtonText: options.confirmButtonText || '确定',
        autofocus: false
      }
    )
      .then(resolve)
      .catch(reject);
  });
};
